/**
 * @Author：ming
 * @Date：2023/10/2 6:20 AM
 * @Filename：Lc1446
 */

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author ming
 */
public class Lc1446 {
    public int maxPower(String s) {
        if(s.length()==0){
            return 0;
        }

        String res = "([a-z])(\\1)+";

        Pattern compile = Pattern.compile(res);
        Matcher matcher = compile.matcher(s);
        int len =1;
        while (matcher.find()){
            String group = matcher.group();

            if(group.length()>len){
                len = group.length();
            }
        }
        return len;
    }
}
